<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="container"></div>
  <script src="/xuni/bundle.js"></script>

  <script>
    //模板字符串
    var templateStr = `
      <div>
        <ul>
          {{#students}}
            <li>{{name}}的爱好是:
              <ol>
                {{#hobbies}}
                  <li>{{.}}</li>
                {{/hobbies}}
              </ol>
            </li>
          {{/students}}  
        </ul>
      <div/>
    `;
    //数据
    var data = {
      students: [
        { 'name': '小明', 'hobbies': ['游泳', '健身'] },
        { 'name': '小红', 'hobbies': ['足球', '篮球', '羽毛球'] },
        { 'name': '小强', 'hobbies': ['吃饭', '睡觉'] },
      ]
    };

    //调用render
    var domStr = templateEngine.render(templateStr, data);
    //渲染上树
    var container = document.getElementById('container');
    container.innerHTML = domStr;
  </script>
</body>

</html>